﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using MyLocalChurch.Models.Resources;

namespace MyLocalChurch.Models
{
    public class Barcode
    {
        public int Id { get; set; }

        [Required(ErrorMessageResourceName = "Required", ErrorMessageResourceType = typeof(ErrorMessages))]
        [StringLength(12, MinimumLength = 12, ErrorMessageResourceName = "Invalid", ErrorMessageResourceType = typeof(ErrorMessages))]
        public string Code { get; set; }

        [DataType(DataType.DateTime, ErrorMessageResourceName = "Invalid", ErrorMessageResourceType = typeof(ErrorMessages))]
        public DateTime? ExpirationDate { get; set; }

        public Barcode(string code)
        {
            Code = code;
            ExpirationDate = null;
        }

        public Barcode() : this(default(string))
        {
        }
    }
}